var status = 0;
        var choice;
        var itemxh = new Array("1202139","1202200","1202120","1202000","1202001","1202002","1202003 ","1202004","1202220","1202219","1202218","1202190","1202191","1202192","1202116","1202158","1202149","1202213", "1202212","1202211","1202210", "1202206", "1202207", "1202208", "1202209");
        var itemxhcost = new Array("5000","9888","9888","12000","12000","12000","12000","12000","15000","15000","15000","18000","18000","18000","21000","21000","9000","21000","21000","21000","21000","21000","21000","21000","21000","21000","21000","21000","21000","21000","21000","21000");
        function start() {
        status = - 1;
                action(1, 0, 0);
        }

		function action(mode, type, selection) {
if (mode == - 1) cm.dispose();
        else {
        if (status == 0 && mode == 0) {
        cm.dispose();
                return;
        } else if (status >= 1 && mode == 0) {
        cm.sendOk("没关系想好了再下手~");
                cm.dispose();
                return;
        }
        if (mode == 1) status++;
                else status--;
                if (status == 0) {
        choices = "#e#rPPMS活跃度 - 图腾商店\r\n#rPS:#d#n请先清理背包否则后果自负,本商店使用PPMS活跃度作为货币交易物品哦~#r#e #n#b";
                for (var i = 0; i < itemxh.length; i++) {
        choices += "\r\n#b#L" + i + "##v" + itemxh[i] + "##z" + itemxh[i] + "#　#d需要#r" + itemxhcost[i] + "#dPPMS活跃度#k#l";
        }
        cm.sendSimpleS("" + choices, 2);
        } else if (status == 1) {
        cm.sendGetNumber("你选择的商品为#b#v" + itemxh[selection] + "#售价为：" + itemxhcost[selection] + "PPMS活跃度/张\r\n请输入你购买的数量", 1, 1, cm.getPlayer().getCSPoints(1));
                choice = selection;
        } else if (status == 2) {
        fee = selection;
                money = fee * itemxhcost[choice];
                if (fee < 0) {
        cm.sendOk("不能输入0.或者你没有足够的PPMS活跃度支付你要买的数量.!");
                cm.dispose();
        } else if (cm.getPlayer().getPlayerPoints() < money) {
        cm.sendOk("购买失败，你没有" + money + "PPMS活跃度");
                cm.dispose();
        } else {
				cm.gainPlayerPoints( -money);
                cm.gainItem(itemxh[choice], fee);
     		    cm.worldSpouseMessage(0x19, "[PPMS活跃度 - 图腾商城] :" + cm.getChar().getName()+ " "+"兑换稀有图腾成功！");
                cm.sendOk("恭喜，购买成功。消耗掉 " + money + "活跃值 您现在的活跃值总值是: " + cm.getPlayerPoints() + " 点...." + cm.getServerName()+ "期待与您共度美好时光~");
                cm.dispose();
        }
        }
        }
}

